// Initialize your app
var myApp = new Framework7({
    init: false,
    animateNavBackIcon: true,
    swipePanel: 'left'
});

// Export selectors engine
var $$ = Dom7;

// Add main View
var mainView = myApp.addView('.view-main', {
    // Enable dynamic Navbar
    dynamicNavbar: true,
    // Enable Dom Cache so we can use all inline pages
    domCache: true
});

/**
 *  页面加载通用模块 START
 */
$$(document).on('pageBeforeInit', function (e) {
    var page = e.detail.page;
    myApp.showIndicator();
});
$$(document).on('pageInit', function (e) {
    var page = e.detail.page;
    myApp.hideIndicator();
    /**
     * 工具栏切换 START
     */
    var pageName = page.name;
    var targetEle = $$('.toolbar.tabbar .toolbar-inner').find('a');
    var activitiesTab = targetEle.eq(0);
    var businessTab = targetEle.eq(1);
    var userTab = targetEle.eq(2);
    switch (pageName) {
        case 'activities':
            if (!activitiesTab.hasClass('active')) {
                activitiesTab.addClass('active')
            }
            businessTab.removeClass('active');
            userTab.removeClass('active');
            break;
        case 'business':
            if (!businessTab.hasClass('active')) {
                businessTab.addClass('active')
            }
            activitiesTab.removeClass('active');
            userTab.removeClass('active');
            break;
        case 'user':
            if (!userTab.hasClass('active')) {
                userTab.addClass('active')
            }
            activitiesTab.removeClass('active');
            businessTab.removeClass('active');
            break;

    }
    // 工具栏切换 END
});
//  页面加载通用模块 END
myApp.onPageInit('index', function (page) {

});
myApp.onPageInit('about', function (page) {

});

myApp.onPageInit('user-img', function (page) {

});
// page-about
myApp.init();